package com.infra.micro.oss.controller;

import com.infra.common.resp.Response;
import com.infra.micro.oss.domain.service.UploadService;
import com.infra.micro.oss.model.vo.BizFileVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.List;

@RequestMapping("/api/oss/file/upload")
@RestController
@Api(tags = {"文件上传服务"})
public class UploadController {
    @Resource
    private UploadService uploadService;

    @ApiOperation(value = "文件上传", notes = "文件上传(支持批量)", produces = "application/json")
    @PostMapping(value = "")
    public Response<List<BizFileVO>> upload(HttpServletRequest request) throws IOException {
        return uploadService.upload(request);
    }
}
